package cn.lg.soar.database.enums;

import cn.lg.soar.common.annotations.DictDefine;
import cn.lg.soar.common.data.dict.IDict;
import com.baomidou.mybatisplus.annotation.IEnum;

/**
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@DictDefine(name = "数据规则条件表达式")
public enum ExpressionEnum implements IDict<Integer>, IEnum<Integer> {

    eq("等于", 0, "{0}={1}"),
    ne("不等于", 1, "{0}<>{1}"),
    lt("小于", 2, "{0}<{1}"),
    gt("大于", 3, "{0}>{1}"),
    le("小于等于", 4, "{0}<={1}"),
    ge("大于等于", 5, "{0}>={1}"),
    like("包含", 6, "{0} LIKE '%{1}%'"),
    likeRight("右包含", 7, "{0} LIKE '{1}%'"),
    likeLeft("左包含", 8, "{0} LIKE '%{1}'"),
    notLike("不包含", 9, "{0} NOT LIKE '%{1}%'"),
    in("在列表", 10, "{0} IN({1})"),
    notIn("不在列表", 11, "{0} NOT IN({1})"),
    isNull("是null", 12, "{0} IS NULL"),
    isNotNull("不是null", 13, "{0} IS NOT NULL");

    ExpressionEnum(String label, int value, String expression){
        this.label = label;
        this.value = value;
        this.expression = expression;
    }

    private final String label;
    private final int value;
    private final String expression;
    @Override
    public Integer getValue() {
        return this.value;
    }
    @Override
    public String getLabel() {
        return this.label;
    }
    public String getExpression() {
        return expression;
    }

}
